package org.opportunity.wishlist.travelwish.pojo.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name="menu")
public class Menu implements Serializable {

    private static final long serialVersionUID = -4935204756306913055L;
    
    private long id;
    private String propertyName;
    private String propertyDescription;
    private Set<SubMenu> subMenus;
    
    public Menu() {
    }
       
    @Id
    @GeneratedValue
    @Column(name="id")
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    
    @Column(name="property_name")
    public String getPropertyName() {
        return propertyName;
    }
    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }
    
    @Column(name="property_description")
    public String getPropertyDescription() {
        return propertyDescription;
    }
    public void setPropertyDescription(String propertyDescription) {
        this.propertyDescription = propertyDescription;
    }
    
    @ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER)
    @JoinTable(name="menu_submenu", 
	    joinColumns = {@JoinColumn(name="menu_id")},
	    inverseJoinColumns = {@JoinColumn(name="submenu_id")}
    )
    public Set<SubMenu> getSubMenus() {
        return subMenus;
    }
    public void setSubMenus(Set<SubMenu> subMenus) {
        this.subMenus = subMenus;
    }
    
    

}
